# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String
from sqlalchemy.schema import FetchedValue
from utils.ORM.session import Model

class Member(Model):
    __tablename__ = 'member'

    id = Column(Integer, primary_key=True)
    nickname = Column(String(100), nullable=False, server_default=FetchedValue())
    mobile = Column(String(11), nullable=False, server_default=FetchedValue())
    sex = Column(Integer, nullable=False, server_default=FetchedValue())
    avatar = Column(String(200), nullable=False, server_default=FetchedValue())
    salt = Column(String(32), nullable=False, server_default=FetchedValue())
    reg_ip = Column(String(100), nullable=False, server_default=FetchedValue())
    status = Column(Integer, nullable=False, server_default=FetchedValue())
    updated_time = Column(DateTime, nullable=False, server_default=FetchedValue())
    created_time = Column(DateTime, nullable=False, server_default=FetchedValue())

    # @property
    # def status_desc(self):
    #     return app.config['STATUS_MAPPING'][ str( self.status ) ]
    #
    # @property
    # def sex_desc(self):
    #     sex_mapping = {
    #         "0":"未知",
    #         "1":"男",
    #         "2":"女"
    #     }
    #     return sex_mapping[str(self.sex)]